import 'package:pacsun/theme/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';

class SheetContainer extends StatelessWidget {
  final Widget child;
  final EdgeInsets padding;
  final DecorationImage? bgImage;
  const SheetContainer({
    super.key,
    required this.child,
    this.padding = const EdgeInsets.only(left: 17, right: 11),
    this.bgImage = null,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: AppColors.sheetBgColor,
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(10),
          topRight: Radius.circular(10),
        ),
        image: bgImage,
      ),
      padding: padding.r,
      child: child,
    );
  }
}

// onPressed: ,
class SheetContainerHeader extends StatelessWidget {
  final List<Widget>? actions;
  final String? title;
  const SheetContainerHeader({super.key, this.actions, this.title});

  @override
  Widget build(BuildContext context) {
    return PreferredSize(
      preferredSize: Size.fromHeight(30.h),
      child: AppBar(
        leading: GestureDetector(
          child: SvgPicture.asset(
            'assets/icons/icon_close.svg',
            width: 24.w,
            height: 24.w,
          ),
          onTap: () => Navigator.pop(context),
        ),
        leadingWidth: 24.w,
        backgroundColor: Colors.transparent,
        title: Text(
          title ?? '',
          style: customTextStyle(fontSize: 16, fontWeight: 600),
        ), // 中间
        actions: actions,
      ),
    );
  }
}
